package com.snowruin.springbootmycat.controller;

import com.snowruin.springbootmycat.dao.UserMapper;
import com.snowruin.springbootmycat.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: 用户controller
 * @author: zxm
 * @version: 1.0.0
 * @date: 2019-08-24 17:24:37
 * @url https://www.snowruin.com
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserMapper userMapper;


    @RequestMapping("/save")
    public String save(User user){
        userMapper.insert(user);
        return "保存成功";
    }



    @RequestMapping("/list")
    public List<User> list(){
        return userMapper.selectAll();
    }


}
